﻿package {
	import flash.display.*;
	import flash.events.*;
	import flash.geom.*;
	
	public class Star extends Shape {
		private var prevX:Number;
		private var prevY:Number;
		
		public function Star():void {
			addEventListener(Event.ADDED_TO_STAGE, added);
		}
		
		private var p1:Point = new Point();
		private function added(e:Event):void {
			removeEventListener(Event.ADDED_TO_STAGE, added);
			
			p1.x = x, p1.y = y;
			p1 = localToGlobal(p1);
			prevX = p1.x, prevY = p1.y;
		}
		
		private var p2:Point = new Point();
		public function update():void {
			p2.x = x, p2.y = y;
			p2 = localToGlobal(p2);
			
			graphics.clear();
			graphics.lineStyle(0, 0xFFFFFF, 1, true, "none");
			graphics.lineTo(p1.x - p2.x + 1, p1.y - p2.y + 1);
			
			p1.x = x, p1.y = y;
			p1 = localToGlobal(p1);
			prevX = p1.x, prevY = p1.y;
		}
	}
}